home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / monsev10.zip / AI.QC next >
Text File  |  1996-09-06  |  18KB  |  825 lines

  1. void() movetarget_f;
  2. void() t_movetarget;
  3. void() knight_walk1;
  4. void() knight_bow6;
  5. void() knight_bow1;
  6. void(entity etemp, entity stemp, entity stemp, float dmg) T_Damage;
  7. /*
  8.  
  9. .enemy
  10. Will be world if not currently angry at anyone.
  11.  
  12. .movetarget
  13. The next path spot to walk toward.  If .enemy, ignore .movetarget.
  14. When an enemy is killed, the monster will try to return to it's path.
  15.  
  16. .huntt_ime
  17. Set to time + something when the player is in sight, but movement straight for
  18. him is blocked.  This causes the monster to use wall following code for
  19. movement direction instead of sighting on the player.
  20.  
  21. .ideal_yaw
  22. A yaw angle of the intended direction, which will be turned towards at up
  23. to 45 deg / state.  If the enemy is in view and hunt_time is not active,
  24. this will be the exact line towards the enemy.
  25.  
  26. .pausetime
  27. A monster will leave it's stand state and head towards it's .movetarget when
  28. time > .pausetime.
  29.  
  30. walkmove(angle, speed) primitive is all or nothing
  31. */
  32.  
  33.  
  34. //
  35. // globals
  36. //
  37. float    current_yaw;
  38.  
  39. //
  40. // when a monster becomes angry at a player, that monster will be used
  41. // as the sight target the next frame so that monsters near that one
  42. // will wake up even if they wouldn't have noticed the player
  43. //
  44. entity    sight_entity;
  45. float    sight_entity_time;
  46.  
  47. float(float v) anglemod =
  48. {
  49.     while (v >= 360)
  50.         v = v - 360;
  51.     while (v < 0)
  52.         v = v + 360;
  53.     return v;
  54. };
  55.  
  56. /*
  57. ==============================================================================
  58.  
  59. MOVETARGET CODE
  60.  
  61. The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
  62.  
  63. targetname
  64. must be present.  The name of this movetarget.
  65.  
  66. target
  67. the next spot to move to.  If not present, stop here for good.
  68.  
  69. pausetime
  70. The number of seconds to spend standing or bowing for path_stand or path_bow
  71.  
  72. ==============================================================================
  73. */
  74.  
  75.  
  76. void() movetarget_f =
  77. {
  78.     if (!self.targetname)
  79.         objerror ("monster_movetarget: no targetname");
  80.         
  81.     self.solid = SOLID_TRIGGER;
  82.     self.touch = t_movetarget;
  83.     setsize (self, '-8 -8 -8', '8 8 8');
  84.     
  85. };
  86.  
  87. /*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
  88. Monsters will continue walking towards the next target corner.
  89. */
  90. void() path_corner =
  91. {
  92.     movetarget_f ();
  93. };
  94.  
  95.  
  96. /*
  97. =============
  98. t_movetarget
  99.  
  100. Something has bumped into a movetarget.  If it is a monster
  101. moving towards it, change the next destination and continue.
  102. ==============
  103. */
  104. void() t_movetarget =
  105. {
  106. local entity    temp;
  107.  
  108.     if (other.movetarget != self)
  109.         return;
  110.     
  111.     if (other.enemy)
  112.         return;        // fighting, not following a path
  113.  
  114.     temp = self;
  115.     self = other;
  116.     other = temp;
  117.  
  118.     if (self.classname == "monster_ogre")
  119.         sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
  120.  
  121. //dprint ("t_movetarget\n");
  122.     self.goalentity = self.movetarget = find (world, targetname, other.target);
  123.     self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
  124.     if (!self.movetarget)
  125.     {
  126.         self.pausetime = time + 999999;
  127.         self.th_stand ();
  128.         return;
  129.     }
  130. };
  131.  
  132.  
  133.  
  134. //============================================================================
  135.  
  136. /*
  137. =============
  138. range
  139.  
  140. returns the range catagorization of an entity reletive to self
  141. 0    melee range, will become hostile even if back is turned
  142. 1    visibility and infront, or visibility and show hostile
  143. 2    infront and show hostile
  144. 3    only triggered by damage
  145. =============
  146. */
  147. float(entity targ) range =
  148. {
  149. local vector    spot1, spot2;
  150. local float        r;    
  151.     spot1 = self.origin + self.view_ofs;
  152.     spot2 = targ.origin + targ.view_ofs;
  153.     
  154.     r = vlen (spot1 - spot2);
  155.     if (r < 120)
  156.         return RANGE_MELEE;
  157.     if (r < 500)
  158.         return RANGE_NEAR;
  159.     if (r < 1000)
  160.         return RANGE_MID;
  161.     return RANGE_FAR;
  162. };
  163.  
  164. /*
  165. =============
  166. visible
  167.  
  168. returns 1 if the entity is visible to self, even if not infront ()
  169. =============
  170. */
  171. float (entity targ) visible =
  172. {
  173.     local vector    spot1, spot2;
  174.     
  175.     spot1 = self.origin + self.view_ofs;
  176.     spot2 = targ.origin + targ.view_ofs;
  177.     traceline (spot1, spot2, TRUE, self);    // see through other monsters
  178.     
  179.     if (trace_inopen && trace_inwater)
  180.         return FALSE;            // sight line crossed contents
  181.  
  182.     if (trace_fraction == 1)
  183.         return TRUE;
  184.     return FALSE;
  185. };
  186.  
  187.  
  188. /*
  189. =============
  190. infront
  191.  
  192. returns 1 if the entity is in front (in sight) of self
  193. =============
  194. */
  195. float(entity targ) infront =
  196. {
  197.     local vector    vec;
  198.     local float        dot;
  199.     
  200.     makevectors (self.angles);
  201.     vec = normalize (targ.origin - self.origin);
  202.     dot = vec * v_forward;
  203.     
  204.     if ( dot > 0.3)
  205.     {
  206.         return TRUE;
  207.     }
  208.     return FALSE;
  209. };
  210.  
  211.  
  212. //============================================================================
  213.  
  214. /*
  215. ===========
  216. ChangeYaw
  217.  
  218. Turns towards self.ideal_yaw at self.yaw_speed
  219. Sets the global variable current_yaw
  220. Called every 0.1 sec by monsters
  221. ============
  222. */
  223. /*
  224.  
  225. void() ChangeYaw =
  226. {
  227.     local float        ideal, move;
  228.  
  229. //current_yaw = self.ideal_yaw;
  230. // mod down the current angle
  231.     current_yaw = anglemod( self.angles_y );
  232.     ideal = self.ideal_yaw;
  233.     
  234.     if (current_yaw == ideal)
  235.         return;
  236.     
  237.     move = ideal - current_yaw;
  238.     if (ideal > current_yaw)
  239.     {
  240.         if (move > 180)
  241.             move = move - 360;
  242.     }
  243.     else
  244.     {
  245.         if (move < -180)
  246.             move = move + 360;
  247.     }
  248.         
  249.     if (move > 0)
  250.     {
  251.         if (move > self.yaw_speed)
  252.             move = self.yaw_speed;
  253.     }
  254.     else
  255.     {
  256.         if (move < 0-self.yaw_speed )
  257.             move = 0-self.yaw_speed;
  258.     }
  259.  
  260.     current_yaw = anglemod (current_yaw + move);
  261.  
  262.     self.angles_y = current_yaw;
  263. };
  264.  
  265. */
  266.  
  267.  
  268. //============================================================================
  269.  
  270. void() HuntTarget =
  271. {
  272.     self.goalentity = self.enemy;
  273.     self.think = self.th_run;
  274.     self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
  275.     self.nextthink = time + 0.1;
  276.     SUB_AttackFinished (1);    // wait a while before first attack
  277. };
  278.  
  279. void() evasion = 
  280.  
  281. //SCC.  In a nutshell:
  282. //Check to see if your avoid target (self.avoid) is still active.  If so,
  283. //set ideal yaw away from it.  If you can no longer progress along this yaw,
  284. //check to see if a course correction to one side or the other (flank1 or
  285. //flank2) will let you proceed.  If not, you're up against a wall or in a
  286. //corner.  In that case, you must return to combat (in strafing mode if one
  287. //of the monster types noted below).
  288.  
  289. {
  290. local float flank1;
  291. local float flank2;
  292.  
  293.         if (avoidtarget == world && !self.avoid.health)
  294.         {
  295.                 self.avoid = world;    //there is no entity left to avoid,
  296.                 return;                //so return to normal program flow.
  297.         }
  298.  
  299.         self.ideal_yaw = vectoyaw (self.origin - self.avoid.origin);
  300.         ChangeYaw();
  301.                         //ideal yaw is directly away from self.avoid entity
  302.  
  303.         if (walkmove (self.ideal_yaw, movedist) == FALSE)  //can't proceed. 
  304.         {                                       //Try course correction.
  305.                flank1 = self.ideal_yaw + 75;    //(this can go a little 
  306.                flank2 = self.ideal_yaw - 75;    //higher, but 80 is
  307.                                                 //pushing it.)
  308.  
  309.                if (walkmove (flank1, movedist) == FALSE)
  310.                {
  311.                      if (walkmove (flank2, movedist) == FALSE)
  312.                      {
  313.                             if (self.classname == "monster_shambler"
  314.                             || self.classname == "monster_hell_knight"
  315.                             || self.classname == "monster_enforcer"
  316.                             || self.classname == "monster_army")
  317.                                   self.attack_state = AS_SLIDING;  //strafing
  318.                             self.avoid = world;  //must return to combat
  319.                             return;
  320.                      }
  321.                }
  322.         }
  323. };
  324.  
  325. void() SightSound =
  326. {
  327. local float    rsnd;
  328.  
  329.     if (self.classname == "monster_ogre")    
  330.         sound (self, CHAN_VOICE, "ogre/ogwake.wav", 1, ATTN_NORM);
  331.     else if (self.classname == "monster_knight")
  332.         sound (self, CHAN_VOICE, "knight/ksight.wav", 1, ATTN_NORM);
  333.     else if (self.classname == "monster_shambler")
  334.         sound (self, CHAN_VOICE, "shambler/ssight.wav", 1, ATTN_NORM);
  335.     else if (self.classname == "monster_demon1")
  336.         sound (self, CHAN_VOICE, "demon/sight2.wav", 1, ATTN_NORM);
  337.     else if (self.classname == "monster_wizard")
  338.         sound (self, CHAN_VOICE, "wizard/wsight.wav", 1, ATTN_NORM);
  339.     else if (self.classname == "monster_zombie")
  340.         sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_NORM);
  341.     else if (self.classname == "monster_dog")
  342.         sound (self, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
  343.     else if (self.classname == "monster_hell_knight")
  344.         sound (self, CHAN_VOICE, "hknight/sight1.wav", 1, ATTN_NORM);
  345.     else if (self.classname == "monster_tarbaby")
  346.         sound (self, CHAN_VOICE, "blob/sight1.wav", 1, ATTN_NORM);
  347.     else if (self.classname == "monster_vomit")
  348.         sound (self, CHAN_VOICE, "vomitus/v_sight1.wav", 1, ATTN_NORM);
  349.     else if (self.classname == "monster_enforcer")
  350.     {
  351.         rsnd = rint(random() * 3);            
  352.         if (rsnd == 1)
  353.             sound (self, CHAN_VOICE, "enforcer/sight1.wav", 1, ATTN_NORM);
  354.         else if (rsnd == 2)
  355.             sound (self, CHAN_VOICE, "enforcer/sight2.wav", 1, ATTN_NORM);
  356.         else if (rsnd == 0)
  357.             sound (self, CHAN_VOICE, "enforcer/sight3.wav", 1, ATTN_NORM);
  358.         else
  359.             sound (self, CHAN_VOICE, "enforcer/sight4.wav", 1, ATTN_NORM);
  360.     }
  361.     else if (self.classname == "monster_army")
  362.         sound (self, CHAN_VOICE, "soldier/sight1.wav", 1, ATTN_NORM);
  363.     else if (self.classname == "monster_shalrath")
  364.         sound (self, CHAN_VOICE, "shalrath/sight.wav", 1, ATTN_NORM);
  365. };
  366.  
  367. void() FoundTarget =
  368. {
  369.     if (self.enemy.classname == "player")
  370.     {    // let other monsters see this monster for a while
  371.         sight_entity = self;
  372.         sight_entity_time = time;
  373.     }
  374.     
  375.     self.show_hostile = time + 1;        // wake up other monsters
  376.  
  377.     SightSound ();
  378.     HuntTarget ();
  379. };
  380.  
  381. /*
  382. ===========
  383. FindTarget
  384.  
  385. Self is currently not attacking anything, so try to find a target
  386.  
  387. Returns TRUE if an enemy was sighted
  388.  
  389. When a player fires a missile, the point of impact becomes a fakeplayer so
  390. that monsters that see the impact will respond as if they had seen the
  391. player.
  392.  
  393. To avoid spending too much time, only a single client (or fakeclient) is
  394. checked each frame.  This means multi player games will have slightly
  395. slower noticing monsters.
  396. ============
  397. */
  398. float() FindTarget =
  399. {
  400.     local entity    client;
  401.     local float        r;
  402.  
  403. // if the first spawnflag bit is set, the monster will only wake up on
  404. // really seeing the player, not another monster getting angry
  405.  
  406. // spawnflags & 3 is a big hack, because zombie crucified used the first
  407. // spawn flag prior to the ambush flag, and I forgot about it, so the second
  408. // spawn flag works as well
  409.     if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3) )
  410.     {
  411.         client = sight_entity;
  412.         if (client.enemy == self.enemy)
  413.             return;
  414.     }
  415.     else
  416.     {
  417.         client = checkclient ();
  418.         if (!client)
  419.             return FALSE;    // current check entity isn't in PVS
  420.     }
  421.  
  422.     if (client == self.enemy)
  423.         return FALSE;
  424.  
  425.     if (client.flags & FL_NOTARGET)
  426.         return FALSE;
  427.     if (client.items & IT_INVISIBILITY)
  428.         return FALSE;
  429.  
  430.     r = range (client);
  431.     if (r == RANGE_FAR)
  432.         return FALSE;
  433.         
  434.     if (!visible (client))
  435.         return FALSE;
  436.  
  437.     if (r == RANGE_NEAR)
  438.     {
  439.         if (client.show_hostile < time && !infront (client))
  440.             return FALSE;
  441.     }
  442.     else if (r == RANGE_MID)
  443.     {
  444.         if ( /* client.show_hostile < time || */ !infront (client))
  445.             return FALSE;
  446.     }
  447.     
  448. //
  449. // got one
  450. //
  451.     self.enemy = client;
  452.     if (self.enemy.classname != "player")
  453.     {
  454.         self.enemy = self.enemy.enemy;
  455.         if (self.enemy.classname != "player")
  456.         {
  457.             self.enemy = world;
  458.             return FALSE;
  459.         }
  460.     }
  461.     
  462.     FoundTarget ();
  463.  
  464.     return TRUE;
  465. };
  466.  
  467.  
  468. //=============================================================================
  469.  
  470. void(float dist) ai_forward =
  471. {
  472.     walkmove (self.angles_y, dist);
  473. };
  474.  
  475. void(float dist) ai_back =
  476. {
  477.     walkmove ( (self.angles_y+180), dist);
  478. };
  479.  
  480.  
  481. /*
  482. =============
  483. ai_pain
  484.  
  485. stagger back a bit
  486. =============
  487. */
  488. void(float dist) ai_pain =
  489. {
  490.     ai_back (dist);
  491. /*
  492.     local float    away;
  493.     
  494.     away = anglemod (vectoyaw (self.origin - self.enemy.origin) 
  495.     + 180*(random()- 0.5) );
  496.     
  497.     walkmove (away, dist);
  498. */
  499. };
  500.  
  501. /*
  502. =============
  503. ai_painforward
  504.  
  505. stagger back a bit
  506. =============
  507. */
  508. void(float dist) ai_painforward =
  509. {
  510.     walkmove (self.ideal_yaw, dist);
  511. };
  512.  
  513. /*
  514. =============
  515. ai_walk
  516.  
  517. The monster is walking it's beat
  518. =============
  519. */
  520. void(float dist) ai_walk =
  521. {
  522.     local vector        mtemp;
  523.     
  524.     movedist = dist;
  525.     
  526.     if (self.classname == "monster_dragon")
  527.     {
  528.         movetogoal (dist);
  529.         return;
  530.     }
  531.     // check for noticing a player
  532.     if (FindTarget ())
  533.         return;
  534.  
  535.                 movetogoal (dist);
  536. };
  537.  
  538.  
  539. /*
  540. =============
  541. ai_stand
  542.  
  543. The monster is staying in one place for a while, with slight angle turns
  544. =============
  545. */
  546. void() ai_stand =
  547. {
  548.     if (FindTarget ())
  549.         return;
  550.     
  551.         if (time > self.pausetime)
  552.     {
  553.         self.th_walk ();
  554.         return;
  555.     }
  556.     
  557. // change angle slightly
  558.  
  559. };
  560.  
  561. /*
  562. =============
  563. ai_turn
  564.  
  565. don't move, but turn towards ideal_yaw
  566. =============
  567. */
  568. void() ai_turn =
  569. {
  570.     if (FindTarget ())
  571.         return;
  572.     
  573.     ChangeYaw ();
  574. };
  575.  
  576. //=============================================================================
  577.  
  578. /*
  579. =============
  580. ChooseTurn
  581. =============
  582. */
  583. void(vector dest3) ChooseTurn =
  584. {
  585.     local vector    dir, newdir;
  586.     
  587.     dir = self.origin - dest3;
  588.  
  589.     newdir_x = trace_plane_normal_y;
  590.     newdir_y = 0 - trace_plane_normal_x;
  591.     newdir_z = 0;
  592.     
  593.     if (dir * newdir > 0)
  594.     {
  595.         dir_x = 0 - trace_plane_normal_y;
  596.         dir_y = trace_plane_normal_x;
  597.     }
  598.     else
  599.     {
  600.         dir_x = trace_plane_normal_y;
  601.         dir_y = 0 - trace_plane_normal_x;
  602.     }
  603.  
  604.     dir_z = 0;
  605.     self.ideal_yaw = vectoyaw(dir);    
  606. };
  607.  
  608. /*
  609. ============
  610. FacingIdeal
  611.  
  612. ============
  613. */
  614. float() FacingIdeal =
  615. {
  616.     local    float    delta;
  617.     
  618.     delta = anglemod(self.angles_y - self.ideal_yaw);
  619.     if (delta > 45 && delta < 315)
  620.         return FALSE;
  621.     return TRUE;
  622. };
  623.  
  624.  
  625. //=============================================================================
  626.  
  627. float()    WizardCheckAttack;
  628. float()    DogCheckAttack;
  629.  
  630. float() CheckAnyAttack =
  631. {
  632.     if (!enemy_vis)
  633.         return;
  634.     if (self.classname == "monster_army")
  635.         return SoldierCheckAttack ();
  636.     if (self.classname == "monster_ogre")
  637.         return OgreCheckAttack ();
  638.     if (self.classname == "monster_shambler")
  639.         return ShamCheckAttack ();
  640.     if (self.classname == "monster_demon1")
  641.         return DemonCheckAttack ();
  642.     if (self.classname == "monster_dog")
  643.         return DogCheckAttack ();
  644.     if (self.classname == "monster_wizard")
  645.         return WizardCheckAttack ();
  646.     return CheckAttack ();
  647. };
  648.  
  649.  
  650. /*
  651. =============
  652. ai_run_melee
  653.  
  654. Turn and close until within an angle to launch a melee attack
  655. =============
  656. */
  657. void() ai_run_melee =
  658. {
  659.     self.ideal_yaw = enemy_yaw;
  660.     ChangeYaw ();
  661.  
  662.     if (FacingIdeal())
  663.     {
  664.         self.th_melee ();
  665.                 self.attack_state = AS_STRAIGHT;
  666.     }
  667. };
  668.  
  669.  
  670. /*
  671. =============
  672. ai_run_missile
  673.  
  674. Turn in place until within an angle to launch a missile attack
  675. =============
  676. */
  677. void() ai_run_missile =
  678. {
  679.     self.ideal_yaw = enemy_yaw;
  680.     ChangeYaw ();
  681.     if (FacingIdeal())
  682.     {
  683.         self.th_missile ();
  684.                 self.attack_state = AS_STRAIGHT;
  685.     }
  686. };
  687.  
  688.  
  689. /*
  690. =============
  691. ai_run_slide
  692.  
  693. Strafe sideways, but stay at aproximately the same range
  694. =============
  695. */
  696. void() ai_run_slide =
  697. {
  698.     local float    ofs;
  699.     
  700.     self.ideal_yaw = enemy_yaw;
  701.     ChangeYaw ();
  702.     if (self.lefty)
  703.         ofs = 90;
  704.     else
  705.         ofs = -90;
  706.     
  707.     if (walkmove (self.ideal_yaw + ofs, movedist))
  708.         return;
  709.         
  710.     self.lefty = 1 - self.lefty;
  711.     
  712.     walkmove (self.ideal_yaw - ofs, movedist);
  713. };
  714.  
  715.  
  716. /*
  717. =============
  718. ai_run
  719.  
  720. The monster has an enemy it is trying to kill
  721. =============
  722. */
  723. void(float dist) ai_run =
  724. {
  725.     local    vector    delta;
  726.     local    float    axis;
  727.     local    float    direct, ang_rint, ang_floor, ang_ceil;
  728.         local   float   r;
  729.  
  730.     movedist = dist;
  731.  
  732. //SCC. See if your personal avoid target (self.avoid) is active (something
  733. //other than world).  If so, go to evasion.  If a generic avoidtarget
  734. //(a grenade that has just landed, for example) has become active, see if
  735. //it is nearby (range) and make sure it's not behind a wall or something
  736. //(visible).  If these tests indicate the threat is real, then make it
  737. //your personal avoid target (self.avoid).
  738.  
  739.         if (self.avoid != world)
  740.         {
  741.                 evasion();
  742.                 return;
  743.         }
  744.         else
  745.         {
  746.                 if (avoidtarget != world)
  747.                 {
  748.                        if (visible(avoidtarget) == TRUE)
  749.                        {
  750.                                r = range(avoidtarget);
  751.                                if (r == RANGE_MELEE)
  752.                                {
  753.                                       self.avoid = avoidtarget;
  754.                                       evasion();
  755.                                       return;
  756.                                }                    
  757.                        }
  758.                 }
  759.         }
  760.  
  761. // see if the enemy is dead
  762.     if (self.enemy.health <= 0)
  763.     {
  764.         self.enemy = world;
  765.     // FIXME: look all around for other targets
  766.         if (self.oldenemy.health > 0)
  767.         {
  768.             self.enemy = self.oldenemy;
  769.             HuntTarget ();
  770.         }
  771.         else
  772.         {
  773.             if (self.movetarget)
  774.                 self.th_walk ();
  775.             else
  776.                 self.th_stand ();
  777.             return;
  778.         }
  779.     }
  780.  
  781.     self.show_hostile = time + 1;        // wake up other monsters
  782.  
  783. // check knowledge of enemy
  784.     enemy_vis = visible(self.enemy);
  785.     if (enemy_vis)
  786.         self.search_time = time + 5;
  787.  
  788. // look for other coop players
  789.     if (coop && self.search_time < time)
  790.     {
  791.         if (FindTarget ())
  792.             return;
  793.     }
  794.  
  795.     enemy_infront = infront(self.enemy);
  796.     enemy_range = range(self.enemy);
  797.     enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
  798.     
  799.     if (self.attack_state == AS_MISSILE)
  800.     {
  801. //dprint ("ai_run_missile\n");
  802.         ai_run_missile ();
  803.         return;
  804.     }
  805.     if (self.attack_state == AS_MELEE)
  806.     {
  807. //dprint ("ai_run_melee\n");
  808.         ai_run_melee ();
  809.         return;
  810.     }
  811.  
  812.         if (CheckAnyAttack ())
  813.                 return;                                 // beginning an attack
  814.         
  815.     if (self.attack_state == AS_SLIDING)
  816.     {
  817.         ai_run_slide ();
  818.         return;
  819.     }
  820.         
  821. // head straight in
  822.         movetogoal (dist);        // done in C code...
  823. };
  824.  
  825.